#ifndef SHOGIERROR_H_INCLUDED
#define SHOGIERROR_H_INCLUDED

#include <QString>

struct ShogiErrorText 
{
	int		errorCode;
	const char*	errorString;
};	

enum ShogiErrorCodes
{
	OK		=	0,
	ERROR_PARSING_COMMAND,
	ERROR_CANT_SEND_NOT_CONNECTED,
	END_OF_ERRORS_MARKER
};

// Order is important here, same order as ShogiErrorCodes
static const ShogiErrorText ERRORS[END_OF_ERRORS_MARKER] = 
{
	{ OK							, ""	},
	{ ERROR_PARSING_COMMAND			, "Could not parse command." },
	{ ERROR_CANT_SEND_NOT_CONNECTED	, "Could not send data since not connected."}
};


class ShogiError
{
public:
	ShogiError();
	ShogiError(int errorCode);

	int getErrorCode() const;
	QString getErrorString() const;

	void setError(int errorCode);
	void reset();
	
private:
	int m_nErrorCode;
	QString m_strError;
};

#endif // SHOGIERROR_H_INCLUDED

